<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<?php
$this->load->view('admin/public_header');
?>
<div id="middle">
    <?php
    $this->load->view('admin/public_menu');
    ?>
	<style>input.laydate-icon{ width: 124px; }</style>
    <div class="right"  id="mainFrame">
        <div class="right_cont">
            <ul class="breadcrumb">
                <?php echo $breadcrumb;?>
            </ul>
            <div class="title_right">
            	<strong>所有分组</strong>
                <span class="pull-right margin-bottom-5">                    
                    <a  class="btn btn-info btn-small" href="<?php echo site_url('admin/admins/group/add');?>">
                        <i class="icon-plus icon-white"></i> 添加
                    </a>
                </span>
            </div>
            <table class="table table-bordered table-hover table-striped">
                <tbody>
                <tr align="center">
                	<td width="100"><strong>ID</strong></td>
                    <td><strong>名称</strong></td>
                    <td width="100"><strong>操作</strong></td>
                   </tr>
				<?php foreach($groups as $k=>$val):?>
                    <tr align="center">
                        <td align="center"><?php echo $val['group_id'];?></td>
                        <td align="center"><?php echo $val['group_name'];?></td>
                        <td align="center">
                           <a href="<?php echo site_url('admin/admins/group/edit');?>?id=<?php echo $val['group_id'];?>">编辑</a>
                         <?php if($val['group_id']>1):?>  
                         | <a class="status_opt" href="<?php echo site_url('admin/admins/group/delete');?>?id=<?php echo $val['group_id'];?>">删除</a>
                         <?php endif;?>
                        </td>
                    </tr>
                <?php endforeach;?>
                </tbody>
            </table>
        </div>
    </div>

</div>
<script>
	$('a.status_opt').click(function(){
		if(!confirm('确认要'+$(this).text()+'?'))
		{
			return false;
		}
		var ajaxurl = $(this).attr('href');
		$.ajax({
			url      : ajaxurl,
			type     : 'post',
			cache    : false,
			dataType : 'json',
			success  :function(json) {
				if(json.error=='1')
				{
					alert(json.msg);
					return ;
				}
				else
				{
					alert(json.msg);
					window.location.reload(true);
				}
			}
		});
		return false;
	});
</script>
<?php
$this->load->view('admin/public_footer');
?>